<!--
 * @Author: cest
 * @Date: 2022-08-09 11:04:58
 * @LastEditTime: 2022-08-09 13:34:04
 * @LastEditors: cest
 * @FilePath: /nuxt3-vite/pages/pinia-demo/index.vue
 * @Description: 编辑描述内容
-->

<script setup lang="ts">
import { useCartStore } from '~/store/cart'
const cartStore = useCartStore()
console.log(cartStore)
const handleClickAdd = (e: Object) => {
  console.log('handleClickAdd e', e)
  cartStore.addItem(new Date().toString())
}
</script>

<template lang="pug">
div
  h1 添加到购物车
  button(@click="handleClickAdd") 添加
  h2 购物车列表
  div(v-for="(item,index) in cartStore.rawItems" :key="index")
    | {{ item }}
</template>

<style scoped>

</style>
